package com.iflytek.exam.service.impl;

import java.util.List;
import com.iflytek.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iflytek.exam.mapper.PaperInfoMapper;
import com.iflytek.exam.domain.PaperInfo;
import com.iflytek.exam.service.IPaperInfoService;

/**
 * 记录试卷答案Service业务层处理
 * 
 * @author KK
 * @date 2024-07-09
 */
@Service
public class PaperInfoServiceImpl implements IPaperInfoService 
{
    @Autowired
    private PaperInfoMapper paperInfoMapper;

    /**
     * 查询记录试卷答案
     * 
     * @param quId 记录试卷答案主键
     * @return 记录试卷答案
     */
    @Override
    public PaperInfo selectPaperInfoByQuId(Long quId)
    {
        return paperInfoMapper.selectPaperInfoByQuId(quId);
    }

    /**
 * 查询某卷中所有数据
 *
 * @param examId 查询某卷中所有数据
 * @return 查询某卷中所有数据
 */
    @Override
    public PaperInfo selectPaperInfoByExamId(Long examId)
    {
        return paperInfoMapper.selectPaperInfoByExamId(examId);
    }

    /**
     * 查询记录试卷答案列表
     * 
     * @param paperInfo 记录试卷答案
     * @return 记录试卷答案
     */
    @Override
    public List<PaperInfo> selectPaperInfoList(PaperInfo paperInfo)
    {
        return paperInfoMapper.selectPaperInfoList(paperInfo);
    }

    /**
     * 新增记录试卷答案
     * 
     * @param paperInfo 记录试卷答案
     * @return 结果
     */
    @Override
    public int insertPaperInfo(PaperInfo paperInfo)
    {
        paperInfo.setCreateTime(DateUtils.getNowDate());
        return paperInfoMapper.insertPaperInfo(paperInfo);
    }

    /**
     * 修改记录试卷答案
     * 
     * @param paperInfo 记录试卷答案
     * @return 结果
     */
    @Override
    public int updatePaperInfo(PaperInfo paperInfo)
    {
        return paperInfoMapper.updatePaperInfo(paperInfo);
    }

    /**
     * 批量删除记录试卷答案
     * 
     * @param quIds 需要删除的记录试卷答案主键
     * @return 结果
     */
    @Override
    public int deletePaperInfoByQuIds(Long[] quIds)
    {
        return paperInfoMapper.deletePaperInfoByQuIds(quIds);
    }

    /**
     * 删除记录试卷答案信息
     * 
     * @param quId 记录试卷答案主键
     * @return 结果
     */
    @Override
    public int deletePaperInfoByQuId(Long quId)
    {
        return paperInfoMapper.deletePaperInfoByQuId(quId);
    }

    @Override
    public List<PaperInfo> selectPaperInfoByExamIdAndUserId(Long examId, Long userId) {
        return paperInfoMapper.selectPaperInfoByExamIdAndUserId(examId,userId);
    }

    @Override
    public void deletePaperInfoByExamIdAndUserId(Long examId, Long userId) {
        paperInfoMapper.deletePaperInfoByExamIdAndUserId(examId,userId);
    }

}
